package com.smart.home.utils;

import de.mkammerer.argon2.Argon2;
import de.mkammerer.argon2.Argon2Factory;

public class PasswordEncoderUtils {
    private static final Argon2 ARGON2 = Argon2Factory.create();

    // 加密密码
    public static String Encryption(String rawPassword) {
        return ARGON2.hash(22, 65536, 1, rawPassword.toCharArray());
    }

    // 验证密码
    public static boolean matches(String rawPassword, String encodedPassword) {
        return ARGON2.verify(encodedPassword, rawPassword.toCharArray());
    }
}
